import service from '@/utils/request'

// @Tags SysOrder
// @Summary 创建订单
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.SysOrder true "订单信息"
// @Success 200 {string} string "创建成功"
// @Router /order/createOrder [post]
export const createOrder = (data) => {
  return service({
    url: '/order/createOrder',
    method: 'post',
    data
  })
}

// @Tags SysOrder
// @Summary 删除订单
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.IdsReq true "订单ID"
// @Success 200 {string} string "删除成功"
// @Router /order/deleteOrder [delete]
export const deleteOrder = (data) => {
  return service({
    url: '/order/deleteOrder',
    method: 'delete',
    data
  })
}

// @Tags SysOrder
// @Summary 批量删除订单
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.IdsReq true "订单ID列表"
// @Success 200 {string} string "删除成功"
// @Router /order/deleteOrdersByIds [delete]
export const deleteOrdersByIds = (data) => {
  return service({
    url: '/order/deleteOrdersByIds',
    method: 'delete',
    data
  })
}

// @Tags SysOrder
// @Summary 更新订单
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.SysOrder true "订单信息"
// @Success 200 {string} string "更新成功"
// @Router /order/updateOrder [put]
export const updateOrder = (data) => {
  return service({
    url: '/order/updateOrder',
    method: 'put',
    data
  })
}

// @Tags SysOrder
// @Summary 根据ID获取订单
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query request.GetById true "订单ID"
// @Success 200 {object} response.SysOrderResponse "获取成功"
// @Router /order/findOrder [get]
export const findOrder = (params) => {
  return service({
    url: '/order/getOrderInfo',
    method: 'get',
    params
  })
}

// @Tags SysOrder
// @Summary 分页获取订单列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query request.SearchOrderParams true "分页获取订单列表"
// @Success 200 {object} response.PageResult "获取成功"
// @Router /order/getOrderList [get]
export const getOrderList = (params) => {
  return service({
    url: '/order/getOrderList',
    method: 'get',
    params
  })
}

// @Tags SysOrder
// @Summary 获取所有订单
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {object} response.SysOrderListResponse "获取成功"
// @Router /order/getAllOrders [get]
export const getAllOrders = () => {
  return service({
    url: '/order/getAllOrders',
    method: 'get'
  })
}

// @Tags SysOrder
// @Summary 获取订单分组
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {object} response.OrderGroupsResponse "获取成功"
// @Router /order/getOrderGroups [get]
export const getOrderGroups = () => {
  return service({
    url: '/order/getOrderGroups',
    method: 'get'
  })
}

// @Tags SysOrder
// @Summary 更新订单状态
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.UpdateOrderStatusReq true "更新订单状态"
// @Success 200 {string} string "更新成功"
// @Router /order/updateOrderStatus [put]
export const updateOrderStatus = (data) => {
  return service({
    url: '/order/updateOrderStatus',
    method: 'put',
    data
  })
}

// @Tags SysOrder
// @Summary 获取订单统计
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {object} response.OrderStatsResponse "获取成功"
// @Router /order/getOrderStats [get]
export const getOrderStats = () => {
  return service({
    url: '/order/getOrderStats',
    method: 'get'
  })
}